<?php
namespace app\index\controller;
use think\Controller;
use app\admin\model\Course as CourseModel;

class Index extends Controller
{
    public function index()
    {
        $courses02 = CourseModel::where('school_id','=',0)->where('grade','=',2)->select();
        $courses03 = CourseModel::where('school_id','=',0)->where('grade','=',3)->select();
        $courses04 = CourseModel::where('school_id','=',0)->where('grade','=',4)->select();
        $courses05 = CourseModel::where('school_id','=',0)->where('grade','=',5)->select();
        $courses06 = CourseModel::where('school_id','=',0)->where('grade','=',6)->select();

        $courses12 = CourseModel::where('school_id','=',1)->where('grade','=',2)->select();
        $courses13 = CourseModel::where('school_id','=',1)->where('grade','=',3)->select();
        $courses14 = CourseModel::where('school_id','=',1)->where('grade','=',4)->select();
        $courses15 = CourseModel::where('school_id','=',1)->where('grade','=',5)->select();
        $courses16 = CourseModel::where('school_id','=',1)->where('grade','=',6)->select();

        $this->assign('courses02',$courses02);
        $this->assign('courses03',$courses03);
        $this->assign('courses04',$courses04);
        $this->assign('courses05',$courses05);
        $this->assign('courses06',$courses06);

        $this->assign('courses12',$courses12);
        $this->assign('courses13',$courses13);
        $this->assign('courses14',$courses14);
        $this->assign('courses15',$courses15);
        $this->assign('courses16',$courses16);
        
        return $this->fetch();
    }


    public function details($course_id = 0)
    {
        $course = CourseModel::get($course_id);
        //dump($course);die;
        if($course)
        {
            $this->assign('course',$course);
        } else {
            echo '非法参数！';die;
        }

        return $this->fetch();
    }

    public function select()
    {
        return $this->fetch();
    }
}
